import { cache } from '@/cacheUtils'

describe('cacheUtils', () => {

  let count = 1
  function create(key: string) {
    return count++
  }

  test('cache', () => {
    const newCreate = cache(create)

    expect(newCreate('a')).toBe(1)
    expect(newCreate('b')).toBe(2)
    expect(newCreate('a')).toBe(1)
    expect(newCreate('c')).toBe(3)
    expect(newCreate('a')).toBe(1)
  })

})